//
//  UIButton+HMUtilities.m
//  美团
//
//  Created by Shenzhen_iOS_07 on 16/10/10.
//  Copyright © 2016年 Shenzhen_iOS_07. All rights reserved.
//

#import "UIButton+HMUtilities.h"
#import "UIColor+HMUtilities.h"

@implementation UIButton (HMUtilities)

+ (instancetype)buttonWithTitle:(NSString *)title textColor:(UIColor *)color andSize:(CGFloat)fontsize
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn.titleLabel.text = title; 错误方式
    [btn setTitle:title forState:UIControlStateNormal];
    
    btn.titleLabel.font = [UIFont systemFontOfSize:fontsize];
//    btn.titleLabel.textColor = color;
    [btn setTitleColor:color forState:UIControlStateNormal];
    
    return btn;
}

+ (instancetype)buttonWithTitle:(NSString *)title image:(UIImage *)normalImage andHighLight:(UIImage *)highLightImage
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:title forState:UIControlStateNormal];
    
    [btn setImage:normalImage forState:UIControlStateNormal];
    [btn setImage:highLightImage forState:UIControlStateHighlighted];
    
    return btn;
}

@end
